//
//  UIView+XBAdd.h
//  XBCategoriesDemo
//
//  Created by kevin007 on 2021/4/12.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

#pragma mark - ---------Frame---------
@interface UIView (XBAdd)
@property (nonatomic, assign) CGFloat left;        ///< Shortcut for frame.origin.x.
@property (nonatomic, assign) CGFloat top;         ///< Shortcut for frame.origin.y
@property (nonatomic, assign) CGFloat right;       ///< Shortcut for frame.origin.x + frame.size.width
@property (nonatomic, assign) CGFloat bottom;      ///< Shortcut for frame.origin.y + frame.size.height
@property (nonatomic, assign) CGFloat width;       ///< Shortcut for frame.size.width.
@property (nonatomic, assign) CGFloat height;      ///< Shortcut for frame.size.height.
@property (nonatomic, assign) CGFloat centerX;     ///< Shortcut for center.x
@property (nonatomic, assign) CGFloat centerY;     ///< Shortcut for center.y
@property (nonatomic, assign) CGPoint origin;      ///< Shortcut for frame.origin.
@property (nonatomic, assign) CGSize  size;        ///< Shortcut for frame.size.

#pragma mark - ---------XIB（IBInspectable）---------
///可视化设置边框宽度
@property (nonatomic, assign) IBInspectable CGFloat xibBorderWidth;

///可视化设置边框颜色
@property (nonatomic, strong) IBInspectable UIColor *xibBorderColor;

///可视化设置圆角
@property (nonatomic, assign) IBInspectable CGFloat xibCornerRadius;

#pragma mark - ---------Radius Set---------
/// UIBezierPath设置圆角, 调用该方法前，UIView bounds必须是已确定的，如果使用Masonry等相对布局，请在- (void)layoutSubviews中调用
/// @param radius 圆角半径
/// @param corner UIRectCorner
- (void)setCornerRadiusWithRadius:(CGFloat)radius corner:(UIRectCorner)corner;


/// UIBezierPath设置圆角, rect传布局后的最终frame，如果使用Masonry等相对布局，请在- (void)layoutSubviews中调用
/// @param rect frame
/// @param radius 圆角半径
/// @param corner UIRectCorner
- (void)setCornerRadiusWithRect:(CGRect)rect radius:(CGFloat)radius corner:(UIRectCorner)corner;


/// 设置圆角
/// @param radius 圆角半径
- (void)setLayerCornerRadius:(CGFloat)radius;

/// 设置Border边框
/// @param borderWidth 边框宽
/// @param color 边框颜色
- (void)setLayerBorderWidth:(CGFloat)borderWidth color:(UIColor *)color;

#pragma mark - ---------视图加载相关----------
/// 复用ID, 主要用于tableView | collectionView Cell获取复用ID
+ (NSString *)reusedId;

///从xib中加载视图
+ (instancetype)loadViewFromXib;


/// 移除所有子视图
- (void)removeAllSubviews;
@end

NS_ASSUME_NONNULL_END
